
//Copyright 1997-2009 Syrinx Development, Inc.
//This file is part of the Syrinx Web Application Framework (SWAF).
// == BEGIN LICENSE ==
//
// Licensed under the terms of any of the following licenses at your
// choice:
//
//  - GNU General Public License Version 3 or later (the "GPL")
//    http://www.gnu.org/licenses/gpl.html
//
//  - GNU Lesser General Public License Version 3 or later (the "LGPL")
//    http://www.gnu.org/licenses/lgpl.html
//
//  - Mozilla Public License Version 1.1 or later (the "MPL")
//    http://www.mozilla.org/MPL/MPL-1.1.html
//
// == END LICENSE ==
using System;

namespace Swaf.Scheduler
{
	/// <summary>
	/// Defines the interface used by <tt>IScheduleManager</tt> methods to represent tasks that are being
	/// scheduled.
	/// </summary>
	public interface IScheduledTask
	{
		/// <summary>
		///An implementation of <tt>IScheduledTask</tt> is capable of managing its own scheduling if needed.
		///This can be important to a scheduled task that either has an irregular or complex schedule
		///to meet, or when a specific scheduling mechanism (such as websphere alarm manager) is desired
		///to be used.
		/// </summary>
		bool IsSelfScheduling {get;}
		/// <summary>
		/// Returns the internal Id for this task.
		/// </summary>
		string Id {get;}
		
		/// <summary>
		/// If a task is repeatable, the schedule manager will keep scheduling it if it is not a self
		///	scheduling task.
		/// </summary>
		bool IsRepeatable{get;}

		/// <summary>
		/// Returns true if this task is ready to execute now, based on its frequency.
		/// </summary>
		bool IsReady {get;}

		/// <summary>
		/// Causes the task to execute immediately.
		/// </summary>
		object fireNow();
		
		/// <summary>
		/// Skips an execution.
		/// </summary>
		void moveToNextRepeatTime();
	}
}
